<?php
/**
 * Notes:
 * User: LiaoHong
 * Date: 2025/10/20
 * Time: 9:02
 **/
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\MenuRequest;
use App\Services\Auth\MenuService;


class MenuController extends Controller
{
    /** @var MenuService */
    private MenuService $menuService;

    public function __construct(MenuService $service)
    {
        $this->menuService = $service;
    }


    /**
     * @Notes:获取菜单结构树
     * @author: Liao Hong
     * @Time: 2025/10/21   17:48
     * @Interface treeselect
     */
    public function treeselect()
    {
        return success($this->menuService->treeselect());
    }
    /**
     * @Notes:添加菜单
     * @author: Liao Hong
     * @Time: 2025/10/20   9:30
     * @Interface add
     */
    public function add(MenuRequest $request)
    {
        $data = $request->input();
        return success($this->menuService->add($data));
    }

    /**
     * @Notes:获取单条菜单信息
     * @param MenuRequest $request
     * @return \Illuminate\Http\JsonResponse
     * @author: Liao Hong
     * @Time: 2025/10/21   14:30
     * @Interface getRow
     */
    public function getRow(MenuRequest $request)
    {
        $data = $request->input();
        return success($this->menuService->getRow($data));
    }
    /**
     * @Notes:修改菜单
     * @author: Liao Hong
     * @Time: 2025/10/20   9:30
     * @Interface add
     */
    public function update(MenuRequest $request)
    {
        $data = $request->input();
        return success($this->menuService->update($data));
    }
    /**
     * @Notes:删除部门
     * @author: Liao Hong
     * @Time: 2025/10/20   9:30
     * @Interface add
     */
    public function delete(MenuRequest $request)
    {
        $data = $request->input();
        return success($this->menuService->delete($data));
    }
    /**
     * @Notes:菜单列表
     * @author: Liao Hong
     * @Time: 2025/10/20   9:30
     * @Interface add
     */
    public function list(MenuRequest $request)
    {
        $data = $request->input();
        return success($this->menuService->list($data));
    }

}
